package edu.pxd.cecs.ece510.pocketmanager;

import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;

//public class ExpenseList extends ArrayAdapter<String> {
//	private final Activity context;
//	private final String[] name;
//	//private final String name1;
//	private final Integer[] amount1;
//	AddexpenseActivity a1;
//	private EditText ed1;
//
//	public ExpenseList(Activity context,
//	String[] name, Integer[] amount1) {
//	super(context, R.layout.expense_list, name);
//	this.context = context;
//	this.name = name;
//	this.amount1= amount1;
//	}
//
//	
//	@Override
//	public View getView(int position, View view, ViewGroup parent) {
//	LayoutInflater inflater = context.getLayoutInflater();
//	View rowView= inflater.inflate(R.layout.expense_list, null, true);
//	// view.setClickable(true);
//	TextView participantName = (TextView) rowView.findViewById(R.id.nameText);
//	participantName.setText(name[position]);
//	// ed1 = (EditText)rowView.findViewById(R.id.expense);
//	//TextView participentAmount = (TextView) rowView.findViewById(R.id.amountText);
//	 /*String m = ed1.getText().toString();
//		if(m =="0"){
//			Log.i("edittext",null);
//		}
//		else{
//			Log.d("EditText", ed1.getText().toString());
//		//	Log.d("edittext", m);
//			//amount1[position] = Integer.parseInt(m);
//			amount1[position] = Integer.valueOf(ed1.getText().toString());
//			a1.listAmount[position] = amount1[position];
//		}
//		*/	
//	return rowView;
//	}
//	
//	/*public int getEditValue(int location){
//		
//		return location;
//		
//	}*/
//
//}



public class ExpenseList extends ArrayAdapter<String> {
	public TextView amountTitle; 
	private final Activity context;
	private final String[] name;
	private final String[] amount1;
	
	public ExpenseList(Activity context, String[] name, String[] amount1) {
	super(context, R.layout.expense_list, name);
	//super
	this.context = context;
	this.name = name;
	this.amount1 = amount1;
	}
	@Override
	public View getView(int position, View view, ViewGroup parent) {
	LayoutInflater inflater = context.getLayoutInflater();
	View rowView= inflater.inflate(R.layout.expense_list, null, true);
	TextView nameTitle = (TextView) rowView.findViewById(R.id.nameText);
	nameTitle.setText(name[position]);
	amountTitle = (TextView) rowView.findViewById(R.id.amountText);
	amountTitle.setText(amount1[position]);
	return rowView;
	}

}

